#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>

using namespace std;

int Func1(int* arr, int n)
{
    int count = 0, i = 0;
    while (n)
    {
        count++;
        arr[i++] = n % 10;
        n /= 10;
    }
    return count;
}

int main()
{
    int arr[5] = { 0 }, n = 0;
    cin >> n;
    cout << Func1(arr, n) << endl;
    for (int i = Func1(arr, n) - 1; i >= 0; i--)
    {
        cout << arr[i] << ' ';
    }
    cout << endl;
    for (int i = 0; i < Func1(arr, n); i++)
    {
        cout << arr[i];
    }
    cout << endl;
    return 0;
}